I know of three ways in which SRP helps reduce coupling. Are there even more? [closed]
Posted
by
user1483278
on Programmers
See other posts from Programmers
or by user1483278
Published on 2012-08-28T19:14:42Z
Indexed on
2012/08/28
21:51 UTC
Read the original article
Hit count: 217
design-patterns
|single-responsibility
I'd like to figure all the possible ways SRP helps us reduce coupling. Thus far I can think of three:
1) If class A
has more than one responsibility, these responsibilities become coupled and as such changes to one of these responsibilities may require changes to other of A's
responsibilities.
2) Related functionality usually needs to be changed for the same reason and by grouping it togerther in a single class, the changes can be made in as few places as possible ( at best changes only need be made to the class which groups together these functionalities)
3) Assuming class A
performs two tasks ( thus may change for two reasons ), then number of classes utilising A
will be greater than if A
performed just a single task ( reason being that some classes will need A
to perform first task, other will need A
for second task, and still others will utilise it for both tasks ).This also means that when A
breaks, the number of classes ( utilising A
) being impaired will be greater than if A
performed just a single task.
Can SRP also help reduce coupling in any other way, not described above?
Thank you
© Programmers or respective owner